using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Belmost4PDA.Logic
{
    public partial class HintView : Control
    {
        public string str=null;
        string text = "";
        private int strcount=0;
        private int pos;
        public void SetHint(string s)
        {
         
            str=s;
            strcount = 0;

            text = "";
            while (str.Length > 30)
            {
                text += (str.Substring(0, 30)) + '\n';
                str = str.Remove(0, 30);
                strcount++; 
            }
            text += (str);
            strcount++;
            Height = 18 * strcount;
            pos = pos + 22;

            SetLocation(pos);
            if (strcount>1 )Visible=true;
            else Visible=false;
            Refresh();
        }

        public void SetLocation(int y)
        {
            pos=y;
            Location = new Point(Location.X, pos);
        }


        protected override void OnPaint(PaintEventArgs e)
        {
            
            StringFormat st=new StringFormat();
            st.Alignment = StringAlignment.Center;
            e.Graphics.DrawString(text, new Font("Arial", 10, FontStyle.Regular), new SolidBrush(Color.Black),
                                  e.ClipRectangle,st);
               
            base.OnPaint(e);
         
        }

       
      
    }
}